#include <iostream>
using namespace std;
//第一个C++程序，完成于2021-08-27 by BlackJ. :)
int main()
{
    cout << "************************************************" << endl;

    cout << "本程序实现数字排列，按ctrl+c退出。" << endl;

    cout << "************************************************" << endl;
    cout << "请输入排列方式:【1】正三角、【2】倒三角";
    int sta = 0;
    cin >> sta;

    switch (sta)
    {

    case 1:
        cout << "请输入n:";
        int n1;
        cin >> n1;
        for (int b1 = 1; b1 <= n1; b1++)
        {
            for (int a1 = 1; a1 <= b1; a1++)
            {
                cout << a1 << " ";
            }
            cout << endl;
        }
        break;
    case 2:
        cout << "请输入n:";
        int n2;
        cin >> n2;
        for (int b2 = n2; b2 >= 1; b2--)
        {
            for (int a2 = b2; a2 >= 1; a2--)
            {
                cout << a2 << " ";
            }
            cout << endl;
        }

        break;

    default:;
    }

    //cout << 1 << " " << 2 << endl;

    return 0;
}